package com.msb.user_consumer;

import com.msb.user_api.IUserApi;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

//@FeignClient(name="xx",url = "http://localhost:8001")
@FeignClient(name="user-provider", fallback = UserProviderBack.class)
public interface UserApi extends IUserApi {

    /**
     * 这里 getMapping 是给Feign看的 get请求 user-provider/getMap?id={1}
     * @RequestParam("id") 也是给Feign看的
     *
     * HttpClient Http协议
     * @param id
     * @return
     */
    @GetMapping("/getMap")
    Map<Integer, String> getMap(@RequestParam("id")Integer id);

    /**
     * @RequestParam("id") @RequestParam("name") 不可以删除
     * @param id
     * @param name
     * @return
     */
    @GetMapping("/getMap2")
    Map<Integer, String> getMap2(@RequestParam("id") Integer id,@RequestParam("name") String name);

    @GetMapping("/getMap3")
    Map<Integer, String> getMap3(@RequestParam Map<String, Object> map);

    @PostMapping("/postMap")
    Map<Integer, String> postMap(Map<String, Object> map);

}
